package com.bing.schoolmanager.Servlet;

import com.alibaba.fastjson.JSON;
import com.bing.schoolmanager.pojo.ReturnData;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/exit")
public class ExitServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("appliaction/json;charset=UTF-8");

        req.getSession().invalidate();
        resp.getWriter().write(JSON.toJSONString(new ReturnData(1,"成功退出",null)));
    }
}
